# region_wds = ['df', 'du', 'free', '内存']
region_wds = []
stop_wds = []
question = "df的作用"

import ahocorasick

wordlist = ['周期', '多久', '多长时间', '多少时间', '几天', '几年', '多少天', '多少小时', '几个小时', '多少年']


# ahocorasick实现快速的关键字匹配（返回的是）
def build_actree(wordlist):
    actree = ahocorasick.Automaton()
    for index, word in enumerate(wordlist):
        actree.add_word(word, (index, word))
    actree.make_automaton()
    print(type(actree))
    for i in actree.iter("周期多久几天几个小时"):
        print(i)
        print(i[1][1])
        # print(type(i))
    return actree


region_tree = build_actree(wordlist)



